home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / shared.dxr / 01015_pull down menu.ls < prev    next >
Encoding:
Text File  |  1995-11-21  |  1.6 KB  |  55 lines

  1. property mySprite, myHilite, menuCast, buttonCast, myField, myList, mySelection, myFunction
  2.  
  3. on birth me, spriteNum1, spriteNum2, castNum1, castNum2, fieldName, listString, handler
  4.   set mySprite to spriteNum1
  5.   set myHilite to spriteNum2
  6.   set menuCast to castNum1
  7.   set buttonCast to castNum2
  8.   set myField to fieldName
  9.   set myList to listString
  10.   set mySelection to line 1 of myList
  11.   set myFunction to handler
  12.   puppetSprite(mySprite, 1)
  13.   puppetSprite(myHilite, 1)
  14.   set the textHeight of field myField to 18
  15.   put mySelection into field myField
  16.   return me
  17. end
  18.  
  19. on menuSelect me
  20.   set the castNum of sprite mySprite to menuCast
  21.   updateStage()
  22.   put myList into field myField
  23.   set oldSelection to mySelection
  24.   set doOnce to 1
  25.   repeat while the stillDown or doOnce
  26.     set doOnce to 0
  27.     if rollOver(mySprite) then
  28.       set lineNum to the mouseLine
  29.       if lineNum > 0 then
  30.         set loc to the locV of sprite mySprite - 18
  31.         set the locV of sprite myHilite to loc + (lineNum * 18)
  32.         set the visible of sprite myHilite to 1
  33.         set mySelection to line lineNum of field myField
  34.       end if
  35.     else
  36.       set the visible of sprite myHilite to 0
  37.       set mySelection to oldSelection
  38.     end if
  39.     updateStage()
  40.   end repeat
  41.   set the castNum of sprite mySprite to buttonCast
  42.   set the locV of sprite myHilite to the locV of sprite mySprite
  43.   set the visible of sprite myHilite to 1
  44.   put mySelection into field myField
  45.   updateStage()
  46.   if stringp(myFunction) then
  47.     do(myFunction)
  48.   end if
  49. end
  50.  
  51. on controlSelection me, selection
  52.   set mySelection to line selection of myList
  53.   put mySelection into field myField
  54. end
  55.